<template>
  <div id="app">
    <router-view />
    <theme-picker />
  </div>
</template>

<script>
import ThemePicker from "@/components/ThemePicker";

export default {
  name: "App",
  components: { ThemePicker },
  metaInfo() {
    return {
      title: this.$store.state.settings.dynamicTitle && this.$store.state.settings.title,
      titleTemplate: title => {
        return title ? `${title} - ${process.env.VUE_APP_TITLE}` : process.env.VUE_APP_TITLE
      }
    }
  },
  mounted(){
    window.addEventListener('resize', this.handleResize);
    this.handleResize(); // Call once on mount to set initial size
    if(this.$store.state.other.screenSize.width<1000){
      this.$router.push('/mobile/mobile/index')
    }
  },

  beforeDestroy() {
    window.removeEventListener('resize', this.handleResize);
  },

  methods: {
    handleResize() {
      this.$store.dispatch('other/updateScreenSizeAction', {
        width: window.innerWidth,
        height: window.innerHeight
      });
    }
  }
};
</script>
<style scoped>
#app .theme-picker {
  display: none;
}


</style>
